package com.cqemme.activitiservice.config;


import com.cqemme.activitiservice.listener.ComActivitiEventListener;
import org.activiti.engine.delegate.event.ActivitiEventListener;
import org.activiti.spring.SpringProcessEngineConfiguration;
import org.activiti.spring.boot.ProcessEngineConfigurationConfigurer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

@Component
public class ActivitiListenerConfig implements ProcessEngineConfigurationConfigurer {

    @Autowired
    private ComActivitiEventListener comActivitiEventListener;

    @Override
    public void configure(SpringProcessEngineConfiguration processEngineConfiguration) {

        List<ActivitiEventListener> activitiEventListener=new ArrayList<ActivitiEventListener>();

        //配置全局监听器
        activitiEventListener.add(comActivitiEventListener);

        processEngineConfiguration.setEventListeners(activitiEventListener);

    }

}